package com.tracesystem.controller;


import com.tracesystem.commons.Result;
import com.tracesystem.controller.form.FeedbackForm;
import com.tracesystem.controller.info.FeedbackInfo;
import com.tracesystem.service.IssueCommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 *  反馈信息处理接口
 * </p>
 *
 * @author Kevin Martin
 * @since 2022-03-23
 */
@Api(tags = "反馈信息处理接口")
@RestController
@RequestMapping("/issueComment")
public class IssueCommentController {

    @Autowired
    IssueCommentService issueCommentService;
    /*
     * @Description: 反馈数据接口
     * @Author: JMOCOK
     * @param feedbackForm: 反馈参数对象
     * @return: com.tracesystem.commons.Result 统一返回
     **/

    @PostMapping("/feedback")
    @ApiOperation("新增反馈")
    public Result feedback(@RequestBody @Valid FeedbackForm feedbackForm){
        return issueCommentService.setFeedback(feedbackForm);
    }
    /*
     * @Description:获取缺陷反馈
     * @Author: JMOCOK
     * @param issueId: 缺陷ID
     * @return: com.tracesystem.commons.Result 统一返回
     **/
    @GetMapping("/feedbackList")
    @ApiOperation("获取缺陷反馈")
    @ApiImplicitParam("缺陷ID")
    public Result<FeedbackInfo> FeedbackList(Integer issueId){
        return issueCommentService.loadFeedbackListByIssueId(issueId);
    }
}

